
*** Replication code for "Prime Ministers and Party System Stability in Post-communist Democracies" (Grotz/Weber in World Politics)


clear all
use repl_data

*ssc inst coefplot
*ssc inst estout
*ssc inst mimrgns
// install user-written commands

bysort country election cabinet: gen id1 = _n==1
bysort country election: gen id2 = _n==1
// generate id variables for different levels of analysis

keep if id1==1
// set to cabinet level

foreach var of varlist growth inflation unemployment pm_party_new cab_coalition cab_minority cab_surplus cab_nparties size_diff_pm_coa cab_ideol_range pm_power_ab pres_power_ab president_opposition president_cabparty president_pmparty corruption year_investiture cab_postelec cab_preelec pm_postelec pm_preelec global_growth global_inflation global_unemployment {
	egen `var'_period = wtmean(`var'), by(country election) weight(cab_duration)
} // generate election-level variables

gen cons = 1


* Table A3

sum pmp_cabinet volatility voteshare_new voteshare_diff_pm voteshare_diff_opp voteshare_diff_coa growth inflation unemployment econ_performance_cabinet global_growth global_inflation global_unemployment pm_party_new cab_coalition cab_minority cab_surplus cab_nparties size_diff_pm_coa cab_ideol_range parl_fragmentation parl_polarization avg_district_magni turnout_post turnout_diff pm_power_ab pres_power_ab president_opposition president_cabparty president_pmparty corruption year_investiture cab_postelec cab_preelec num_cabinets pm_postelec pm_preelec num_pms early_election last_cab_caretaker pm_fulltimepolit pm_partyhead pm_minister pm_parliament pm_oppleader pm_euinstitution pm_civilservant pm_communism_dissident pm_communism_government i.pm_communism_party pm_sex


* Figure 1 / Figure 2 / Table A4

gen yab = .1
gen yc = 0
gen yd = -.3
gen yef = -.15
// auxiliary variables for graphs

preserve
keep if id2==1
xtset country election
// set to election level

glm volatility pmp_period l.pmp_period l.volatility cons, cl(country) fam(binom) li(logit) nocons

qui margins, at(pmp_period=(0(.01)1)) atmeans
marginsplot, plotop(ms(none) lc(black)) ciop(recast(rarea) fcol(gs10%50) lw(none)) ysc(titlegap(2)) yti("Predicted electoral volatility", size(5)) xsc(range(-.02 1.02) titlegap(3)) xti("Prime-ministerial performance", size(5)) graphr(margin(2 6 2 2)) ti("(a) M1: Electoral volatility (short-term effect)", c(black) size(5.5)) graphr(fcol(white)) leg(off) addplot(sc yab pmp_period, ms(pipe) mc(black) msi(vsmall) xlab(0 `""Not at all" "successful""' .25 `""Not very" "successful""' .5 `""Moderately" "successful""' .75 `""Fairly" "successful""' 1 `""Very" "successful""') ylab(.1(.1).6, gmax gmin)) name(Fig2a)

qui margins, at(l.pmp_period=(0(.01)1)) atmeans
marginsplot, plotop(ms(none) lc(black)) ciop(recast(rarea) fcol(gs10%50) lw(none)) ysc(titlegap(2)) yti("Predicted electoral volatility", size(5)) xsc(range(-.02 1.02) titlegap(3)) xti("Prime-ministerial performance, lagged", size(5)) graphr(margin(2 6 2 2)) ti("(b) M1: Electoral volatility (lagged effect)", c(black) size(5.5)) graphr(fcol(white)) leg(off) addplot(sc yab pmp_period, ms(pipe) mc(black) msi(vsmall) xlab(0 `""Not at all" "successful""' .25 `""Not very" "successful""' .5 `""Moderately" "successful""' .75 `""Fairly" "successful""' 1 `""Very" "successful""') ylab(.1(.1).6, gmax gmin)) name(Fig2b)

eststo M1: margins, dydx(pmp_period l.pmp_period l.volatility cons) post

glm voteshare_new pmp_period l.pmp_period l.voteshare_new cons, cl(country) fam(binom) li(logit) nocons

qui margins, at(l.pmp_period=(0(.01)1)) atmeans
marginsplot, plotop(ms(none) lc(black)) ciop(recast(rarea) fcol(gs10%50) lw(none)) ysc(titlegap(2)) yti("Predicted vote share", size(5)) xsc(range(-.02 1.02) titlegap(3)) xti("Prime-ministerial performance, lagged", size(5)) graphr(margin(2 6 2 2)) ti("(c) M2: New parties (lagged effect)", c(black) size(5.5)) graphr(fcol(white)) leg(off) addplot(sc yc pmp_period, ms(pipe) mc(black) msi(vsmall) xlab(0 `""Not at all" "successful""' .25 `""Not very" "successful""' .5 `""Moderately" "successful""' .75 `""Fairly" "successful""' 1 `""Very" "successful""') ylab(0(.1).6, gmax gmin)) name(Fig2c)

eststo M2: margins, dydx(pmp_period l.pmp_period l.voteshare_new cons) post

restore
// set back to cabinet level

eststo M3: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm cons, cl(country) fam(gauss) li(ident) nocons

qui margins, at(pmp_cabinet=(0(.01)1)) atmeans
marginsplot, plotop(ms(none) lc(black)) ciop(recast(rarea) fcol(gs10%50) lw(none)) ysc(titlegap(2)) yti("Predicted change of vote share", size(5)) xsc(range(-.02 1.02) titlegap(3)) xti("Prime-ministerial performance", size(5)) graphr(margin(2 6 2 2)) ti("(d) M3: Party of prime minister", c(black) size(5.5)) graphr(fcol(white)) leg(off) addplot(sc yd pmp_cabinet, ms(pipe) mc(black) msi(vsmall) xlab(0 `""Not at all" "successful""' .25 `""Not very" "successful""' .5 `""Moderately" "successful""' .75 `""Fairly" "successful""' 1 `""Very" "successful""') ylab(-.3(.05).1, gmax gmin)) name(Fig2d)

eststo M4: glm voteshare_diff_opp pmp_cabinet voteshare_t0_opp cons, cl(country) fam(gauss) li(ident) nocons

qui margins, at(pmp_cabinet=(0(.01)1)) atmeans
marginsplot, plotop(ms(none) lc(black)) ciop(recast(rarea) fcol(gs10%50) lw(none)) ysc(titlegap(2)) yti("Predicted change of vote share", size(5)) xsc(range(-.02 1.02) titlegap(3)) xti("Prime-ministerial performance", size(5)) graphr(margin(2 6 2 2)) ti("(e) M4: Opposition parties", c(black) size(5.5)) graphr(fcol(white)) leg(off) addplot(sc yef pmp_cabinet, ms(pipe) mc(black) msi(vsmall) xlab(0 `""Not at all" "successful""' .25 `""Not very" "successful""' .5 `""Moderately" "successful""' .75 `""Fairly" "successful""' 1 `""Very" "successful""') ylab(-.15(.05).2, gmax gmin)) name(Fig2e)

eststo M5: glm voteshare_diff_coa pmp_cabinet voteshare_t0_coa cons, cl(country) fam(gauss) li(ident) nocons

qui margins, at(pmp_cabinet=(0(.01)1)) atmeans
marginsplot, plotop(ms(none) lc(black)) ciop(recast(rarea) fcol(gs10%50) lw(none)) ysc(titlegap(2)) yti("Predicted change of vote share", size(5)) xsc(range(-.02 1.02) titlegap(3)) xti("Prime-ministerial performance", size(5)) graphr(margin(2 6 2 2)) ti("(f) M5: Coalition partners", c(black) size(5.5)) graphr(fcol(white)) leg(off) addplot(sc yef pmp_cabinet, ms(pipe) mc(black) msi(vsmall) xlab(0 `""Not at all" "successful""' .25 `""Not very" "successful""' .5 `""Moderately" "successful""' .75 `""Fairly" "successful""' 1 `""Very" "successful""') ylab(-.15(.05).05, gmax gmin)) name(Fig2f)

coefplot (M1), drop(cons) lev(95 90) coeflab(pmp_period = "Prime-ministerial performance" L.pmp_period = "Prime-ministerial performance, lagged" L.volatility = "Lagged dependent variable") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M1: Electoral volatility", size(4) span box bc(gs14)) fysize(2000) text(-.43 .5 "{it:R2=0.247}", place(w) s(3.3)) text(.3 .5 "{it:Partial R2=0.131}", place(w) s(3.3)) name(M1)

coefplot (M2), drop(cons) lev(95 90) coeflab(pmp_period = "Prime-ministerial performance" L.pmp_period = "Prime-ministerial performance, lagged" L.voteshare_new = "Lagged dependent variable") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M2: New parties, vote share", size(4) span box bc(gs14)) fysize(2000) text(-.43 .5 "{it:R2=0.103}", place(w) s(3.3)) text(.3 .5 "{it:Partial R2=0.084}", place(w) s(3.3)) name(M2)

coefplot (M3), drop(cons) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_pm = "Vote share at t-1") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M3: PM party, Δ vote share", size(4) span box bc(gs14)) fysize(1600) text(-.4 .5 "{it:R2=0.241}", place(w) s(3.3)) text(.34 .5 "{it:Partial R2=0.086}", place(w) s(3.3)) name(M3)

coefplot (M4), drop(cons) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_opp = "Vote share at t-1") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M4: Opposition parties, Δ vote share", size(4) span box bc(gs14)) fysize(1600) text(-.4 .5 "{it:R2=0.062}", place(w) s(3.3)) text(.34 .5 "{it:Partial R2=0.036}", place(w) s(3.3)) name(M4)

coefplot (M5), drop(cons) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_coa = "Vote share at t-1") xlab(-.7(.1).5) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 17 5) lc(black)) ti("M5: Coalition partners, Δ vote share", size(4) span box bc(gs14)) fysize(2350) text(-.4 .5 "{it:R2=0.194}", place(w) s(3.3)) text(.34 .5 "{it:Partial R2=0.005}", place(w) s(3.3)) text(4.6 -.65 "Note: Marginal effects with 95% and 90% confidence intervals. Detailed regression results in the appendix (Table A4).", size(small)) name(M5)

gr combine M1 M2 M3 M4 M5, cols(1) iscale(.23) graphr(margin(none)) xsize(8) ysize(4)
gr export Fig1.tif, width(2500) replace

gr combine Fig2a Fig2b Fig2c Fig2d Fig2e Fig2f, cols(2) iscale(.38) graphr(margin(none)) xsize(3) ysize(3)
gr export Fig2.tif, width(2000) replace

estout M1 M2 M3 M4 M5 using TabA4.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace

drop yab yc yd yef


* Figure 3 / Table A9

preserve
keep if id2==1
xtset country election

glm volatility pmp_period l.pmp_period l.volatility econ_performance_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1c: margins, dydx(pmp_period l.pmp_period l.volatility econ_performance_period cons) post

glm voteshare_new pmp_period l.pmp_period l.voteshare_new econ_performance_period cons, cl(country) fam(binom) li(logit) nocons
eststo M2c: margins, dydx(pmp_period l.pmp_period l.voteshare_new econ_performance_period cons) post

restore

eststo M3c: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm econ_performance_cabinet cons, cl(country) fam(gauss) li(ident) nocons

eststo M4c: glm voteshare_diff_opp pmp_cabinet voteshare_t0_opp econ_performance_cabinet cons, cl(country) fam(gauss) li(ident) nocons

eststo M5c: glm voteshare_diff_coa pmp_cabinet voteshare_t0_coa econ_performance_cabinet cons, cl(country) fam(gauss) li(ident) nocons

coefplot (M1c), drop(cons) lev(95 90) coeflab(pmp_period = "Prime-ministerial performance" L.pmp_period = "Prime-ministerial performance, lagged" L.volatility = "Lagged dependent variable" econ_performance_period = "Economic performance") xlab(.) xsc(r(-.7 .52)) xli(0) xsize(20) ysize(2.3) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M1c: Electoral volatility", size(4) span box bc(gs14)) fysize(2300) text(-.43 .5 "{it:R2=0.326}", place(w) s(3.3)) name(M1c)

coefplot (M2c), drop(cons) lev(95 90) coeflab(pmp_period = "Prime-ministerial performance" L.pmp_period = "Prime-ministerial performance, lagged" L.voteshare_new = "Lagged dependent variable" econ_performance_period = "Economic performance") xlab(.) xsc(r(-.7 .52)) xli(0) xsize(20) ysize(2.3) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M2c: New parties, vote share", size(4) span box bc(gs14)) fysize(2300) text(-.43 .5 "{it:R2=0.136}", place(w) s(3.3)) name(M2c)

coefplot (M3c), drop(cons) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_pm = "Vote share at t-1" econ_performance_cabinet = "Economic performance") xlab(.) xsc(r(-.7 .52)) xli(0) xsize(20) ysize(2.3) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M3c: PM party, Δ vote share", size(4) span box bc(gs14)) fysize(1840) text(-.4 .5 "{it:R2=0.339}", place(w) s(3.3)) name(M3c)

coefplot (M4c), drop(cons) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_opp = "Vote share at t-1" econ_performance_cabinet = "Economic performance") xlab(.) xsc(r(-.7 .52)) xli(0) xsize(20) ysize(2.3) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M4c: Opposition parties, Δ vote share", size(4) span box bc(gs14)) fysize(1840) text(-.4 .5 "{it:R2=0.089}", place(w) s(3.3)) name(M4c)

coefplot (M5c), drop(cons) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_coa = "Vote share at t-1" econ_performance_cabinet = "Economic performance") xlab(-.7(.1).5) xsc(r(-.7 .52)) xli(0) xsize(20) ysize(2.3) scale(4) graphr(fcol(white) margin(0 5 17 5) lc(black)) ti("M5c: Coalition partners, Δ vote share", size(4) span box bc(gs14)) fysize(2702.5) text(-.4 .5 "{it:R2=0.207}", place(w) s(3.3)) text(6.5 -.65 "Note: Marginal effects with 95% and 90% confidence intervals. Detailed regression results in the appendix (Table A9).", size(small)) name(M5c)

gr combine M1c M2c M3c M4c M5c, cols(1) iscale(.23) graphr(margin(none)) xsize(8.8) ysize(4.4)
gr export Fig3.tif, width(2500) replace

estout M1c M2c M3c M4c M5c using TabA9.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Figure 4 / Table A15

preserve
keep if id2==1
xtset country election

glm volatility pmp_period l.pmp_period l.volatility i.country cons, cl(country) fam(binom) li(logit) nocons
eststo M1h: margins, dydx(pmp_period l.pmp_period l.volatility) post noestimcheck

glm voteshare_new pmp_period l.pmp_period l.voteshare_new i.country cons, cl(country) fam(binom) li(logit) nocons
eststo M2h: margins, dydx(pmp_period l.pmp_period l.voteshare_new) post noestimcheck

restore

eststo M3h: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm i.country cons, cl(country) fam(gauss) li(ident) nocons

eststo M4h: glm voteshare_diff_opp pmp_cabinet voteshare_t0_opp i.country cons, cl(country) fam(gauss) li(ident) nocons

eststo M5h: glm voteshare_diff_coa pmp_cabinet voteshare_t0_coa i.country cons, cl(country) fam(gauss) li(ident) nocons

coefplot (M1h), drop(cons) lev(95 90) coeflab(pmp_period = "Prime-ministerial performance" L.pmp_period = "Prime-ministerial performance, lagged" L.volatility = "Lagged dependent variable") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M1h: Electoral volatility", size(4) span box bc(gs14)) fysize(2000) text(-.13 .5 "{it:R2=0.457}", place(w) s(3.3)) name(M1h)

coefplot (M2h), drop(cons) lev(95 90) coeflab(pmp_period = "Prime-ministerial performance" L.pmp_period = "Prime-ministerial performance, lagged" L.voteshare_new = "Lagged dependent variable") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M2h: New parties, vote share", size(4) span box bc(gs14)) fysize(2000) text(-.13 .5 "{it:R2=0.316}", place(w) s(3.3)) name(M2h)

coefplot (M3h), drop(cons *country) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_pm = "Vote share at t-1") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M3h: PM party, Δ vote share", size(4) span box bc(gs14)) fysize(1600) text(-.1 .5 "{it:R2=0.335}", place(w) s(3.3)) transform(* = max(min(0.51,@),-.7)) name(M3h)

coefplot (M4h), drop(cons *country) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_opp = "Vote share at t-1") xlab(.) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M4h: Opposition parties, Δ vote share", size(4) span box bc(gs14)) fysize(1600) text(-.1 .5 "{it:R2=0.177}", place(w) s(3.3)) name(M4h)

coefplot (M5h), drop(cons *country) lev(95 90) coeflab(pmp_cabinet = "             Prime-ministerial performance" voteshare_t0_coa = "Vote share at t-1") xlab(-.7(.1).5) xsc(r(-.7 .51)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 17 5) lc(black)) ti("M5h: Coalition partners, Δ vote share", size(4) span box bc(gs14)) fysize(2350) text(-.1 .5 "{it:R2=0.388}", place(w) s(3.3)) text(4.6 -.65 "Note: Marginal effects with 95% and 90% confidence intervals. Detailed regression results in the appendix (Table A15).", size(small)) name(M5h)

gr combine M1h M2h M3h M4h M5h, cols(1) iscale(.23) graphr(margin(none)) xsize(8) ysize(4)
gr export Fig4.tif, width(2500) replace

estout M1h M2h M3h M4h M5h using TabA15.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Figure 5 / Table A19

eststo M10a: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm cons if pm_runs_again==1, cl(country) fam(gauss) li(ident) nocons

eststo M10b: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm cons if pm_runs_again==0, cl(country) fam(gauss) li(ident) nocons

coefplot (M10a), drop(cons) lev(95 90) coeflab(pmp_cabinet = "Prime-ministerial performance" voteshare_t0_pm = "Vote share at t-1") xlab(.) xsc(r(-.8 .7)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 5 5) lc(black)) ti("M10a: PM party, Δ vote share, PM runs again", size(4) span box bc(gs14)) fysize(1400) text(0 .7 "{it:R2=0.321}", place(w) s(3.3)) name(M10a)

coefplot (M10b), drop(cons) lev(95 90) coeflab(pmp_cabinet = "Prime-ministerial performance" voteshare_t0_pm = "Vote share at t-1") xlab(-.8(.1).7) xsc(r(-.8 .7)) xli(0) xsize(20) ysize(2) scale(4) graphr(fcol(white) margin(0 5 17 5) lc(black)) ti("M10b: PM party, Δ vote share, PM does not run", size(4) span box bc(gs14)) fysize(2000) text(0 .7 "{it:R2=0.149}", place(w) s(3.3)) text(4.1 -.6 "Note: Marginal effects with 95% and 90% confidence intervals. Detailed regression results in the appendix (Table A19).", size(small)) name(M10b)

gr combine M10a M10b, cols(1) iscale(.5) graphr(margin(none)) xsize(8) ysize(1.9)
gr export Fig5.tif, width(2500) replace

estout M10a M10b using TabA19.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A5

preserve
keep if id2==1
xtset country election

glm volatility pmp_period l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1_s1: margins, dydx(pmp_period l.pmp_period cons) post

glm volatility pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1_s2: margins, dydx(pmp_period cons) post

glm volatility l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1_s3: margins, dydx(l.pmp_period cons) post

glm voteshare_new pmp_period l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M2_s1: margins, dydx(pmp_period l.pmp_period cons) post

glm voteshare_new pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M2_s2: margins, dydx(pmp_period cons) post

glm voteshare_new l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M2_s3: margins, dydx(l.pmp_period cons) post

restore

eststo M3_s: glm voteshare_diff_pm pmp_cabinet cons, cl(country) fam(gauss) li(ident) nocons

eststo M4_s: glm voteshare_diff_opp pmp_cabinet cons, cl(country) fam(gauss) li(ident) nocons

eststo M5_s: glm voteshare_diff_coa pmp_cabinet cons, cl(country) fam(gauss) li(ident) nocons

estout M1_s1 M1_s2 M1_s3 M2_s1 M2_s2 M2_s3 M3_s M4_s M5_s using TabA5.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A7 / Table A8

preserve
keep if id2==1
xtset country election

glm volatility pmp_deleg_period l.pmp_deleg_period l.volatility cons, cl(country) fam(binom) li(logit) nocons
eststo M1_del: margins, dydx(pmp_deleg_period l.pmp_deleg_period l.volatility cons) post

glm voteshare_new pmp_deleg_period l.pmp_deleg_period l.voteshare_new cons, cl(country) fam(binom) li(logit) nocons
eststo M2_del: margins, dydx(pmp_deleg_period l.pmp_deleg_period l.voteshare_new cons) post

glm volatility pmp_account_period l.pmp_account_period l.volatility cons, cl(country) fam(binom) li(logit) nocons
eststo M1_acc: margins, dydx(pmp_account_period l.pmp_account_period l.volatility cons) post

glm voteshare_new pmp_account_period l.pmp_account_period l.voteshare_new cons, cl(country) fam(binom) li(logit) nocons
eststo M2_acc: margins, dydx(pmp_account_period l.pmp_account_period l.voteshare_new cons) post

restore

eststo M3_del: glm voteshare_diff_pm pmp_deleg_cabinet voteshare_t0_pm cons, cl(country) fam(gauss) li(ident) nocons

eststo M4_del: glm voteshare_diff_opp pmp_deleg_cabinet voteshare_t0_opp cons, cl(country) fam(gauss) li(ident) nocons

eststo M5_del: glm voteshare_diff_coa pmp_deleg_cabinet voteshare_t0_coa cons, cl(country) fam(gauss) li(ident) nocons

eststo M3_acc: glm voteshare_diff_pm pmp_account_cabinet voteshare_t0_pm cons, cl(country) fam(gauss) li(ident) nocons

eststo M4_acc: glm voteshare_diff_opp pmp_account_cabinet voteshare_t0_opp cons, cl(country) fam(gauss) li(ident) nocons

eststo M5_acc: glm voteshare_diff_coa pmp_account_cabinet voteshare_t0_coa cons, cl(country) fam(gauss) li(ident) nocons

estout M1_del M2_del M3_del M4_del M5_del using TabA7.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace

estout M1_acc M2_acc M3_acc M4_acc M5_acc using TabA8.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A10 / Table A11 / Table A12 / Table A13

preserve
keep if id2==1
xtset country election

glm volatility pmp_period l.pmp_period l.volatility growth_period inflation_period unemployment_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1d: margins, dydx(pmp_period l.pmp_period l.volatility growth_period inflation_period unemployment_period cons) post noestimcheck

glm voteshare_new pmp_period l.pmp_period l.voteshare_new growth_period inflation_period unemployment_period cons, cl(country) fam(binom) li(logit) nocons
eststo M2d: margins, dydx(pmp_period l.pmp_period l.voteshare_new growth_period inflation_period unemployment_period cons) post noestimcheck

glm volatility pmp_period l.pmp_period l.volatility pm_party_new_period cab_coalition_period cab_minority_period cab_surplus_period cab_nparties_period size_diff_pm_coa_period cab_ideol_range_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1e: margins, dydx(pmp_period l.pmp_period l.volatility pm_party_new_period cab_coalition_period cab_minority_period cab_surplus_period cab_nparties_period size_diff_pm_coa_period cab_ideol_range_period cons) post noestimcheck

glm voteshare_new pmp_period l.pmp_period l.voteshare_new pm_party_new_period cab_coalition_period cab_minority_period cab_surplus_period cab_nparties_period size_diff_pm_coa_period cab_ideol_range_period cons, cl(country) fam(binom) li(logit) nocons
eststo M2e: margins, dydx(pmp_period l.pmp_period l.voteshare_new pm_party_new_period cab_coalition_period cab_minority_period cab_surplus_period cab_nparties_period size_diff_pm_coa_period cab_ideol_range_period cons) post noestimcheck

glm volatility pmp_period l.pmp_period l.volatility parl_fragmentation parl_polarization avg_district_magni turnout_diff pm_power_ab_period pres_power_ab_period president_opposition_period president_cabparty_period president_pmparty_period corruption_period year_investiture_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1f: margins, dydx(pmp_period l.pmp_period l.volatility parl_fragmentation parl_polarization avg_district_magni turnout_diff pm_power_ab_period pres_power_ab_period president_opposition_period president_cabparty_period president_pmparty_period corruption_period year_investiture_period cons) post noestimcheck

glm voteshare_new pmp_period l.pmp_period l.voteshare_new parl_fragmentation parl_polarization avg_district_magni turnout_diff pm_power_ab_period pres_power_ab_period president_opposition_period president_cabparty_period president_pmparty_period corruption_period year_investiture_period cons, cl(country) fam(binom) li(logit) nocons
eststo M2f: margins, dydx(pmp_period l.pmp_period l.voteshare_new parl_fragmentation parl_polarization avg_district_magni turnout_diff pm_power_ab_period pres_power_ab_period president_opposition_period president_cabparty_period president_pmparty_period corruption_period year_investiture_period cons) post noestimcheck

glm volatility pmp_period l.pmp_period l.volatility cab_postelec_period cab_preelec_period num_cabinets pm_postelec_period pm_preelec_period i.num_pms_collap l.i.num_pms_collap early_election last_cab_caretaker cons, cl(country) fam(binom) li(logit) nocons
eststo M1g: margins, dydx(pmp_period l.pmp_period l.volatility cab_postelec_period cab_preelec_period num_cabinets pm_postelec_period pm_preelec_period i.num_pms_collap l.i.num_pms_collap early_election last_cab_caretaker cons) post noestimcheck

glm voteshare_new pmp_period l.pmp_period l.voteshare_new cab_postelec_period cab_preelec_period num_cabinets pm_postelec_period pm_preelec_period i.num_pms_collap l.i.num_pms_collap early_election last_cab_caretaker cons, cl(country) fam(binom) li(logit) nocons
eststo M2g: margins, dydx(pmp_period l.pmp_period l.voteshare_new cab_postelec_period cab_preelec_period num_cabinets pm_postelec_period pm_preelec_period i.num_pms_collap l.i.num_pms_collap early_election last_cab_caretaker cons) post noestimcheck

restore

eststo M3d: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm growth inflation unemployment cons, cl(country) fam(gauss) li(ident) nocons

eststo M4d: glm voteshare_diff_opp pmp_cabinet voteshare_t0_opp growth inflation unemployment cons, cl(country) fam(gauss) li(ident) nocons

eststo M5d: glm voteshare_diff_coa pmp_cabinet voteshare_t0_coa growth inflation unemployment cons, cl(country) fam(gauss) li(ident) nocons

eststo M3e: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm pm_party_new cab_coalition cab_minority cab_surplus cab_nparties size_diff_pm_coa cab_ideol_range cons, cl(country) fam(gauss) li(ident) nocons

eststo M4e: glm voteshare_diff_opp pmp_cabinet voteshare_t0_opp pm_party_new cab_coalition cab_minority cab_surplus cab_nparties size_diff_pm_coa cab_ideol_range cons, cl(country) fam(gauss) li(ident) nocons

eststo M5e: glm voteshare_diff_coa pmp_cabinet voteshare_t0_coa pm_party_new cab_minority cab_surplus cab_nparties size_diff_pm_coa cab_ideol_range cons, cl(country) fam(gauss) li(ident) nocons

eststo M3f: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm parl_fragmentation parl_polarization avg_district_magni turnout_diff pm_power_ab pres_power_ab president_opposition president_cabparty president_pmparty corruption year_investiture cons, cl(country) fam(gauss) li(ident) nocons

eststo M4f: glm voteshare_diff_opp pmp_cabinet voteshare_t0_opp parl_fragmentation parl_polarization avg_district_magni turnout_diff pm_power_ab pres_power_ab president_opposition president_cabparty president_pmparty corruption year_investiture cons, cl(country) fam(gauss) li(ident) nocons

eststo M5f: glm voteshare_diff_coa pmp_cabinet voteshare_t0_coa parl_fragmentation parl_polarization avg_district_magni turnout_diff pm_power_ab pres_power_ab president_opposition president_cabparty president_pmparty corruption year_investiture cons, cl(country) fam(gauss) li(ident) nocons

eststo M3g: glm voteshare_diff_pm pmp_cabinet voteshare_t0_pm cab_postelec cab_preelec num_cabinets pm_postelec pm_preelec i.num_pms_collap early_election last_cab_caretaker cons, cl(country) fam(gauss) li(ident) nocons

eststo M4g: glm voteshare_diff_opp pmp_cabinet voteshare_t0_opp cab_postelec cab_preelec num_cabinets pm_postelec pm_preelec i.num_pms_collap early_election last_cab_caretaker cons, cl(country) fam(gauss) li(ident) nocons

eststo M5g: glm voteshare_diff_coa pmp_cabinet voteshare_t0_coa cab_postelec cab_preelec num_cabinets pm_postelec pm_preelec i.num_pms_collap early_election last_cab_caretaker cons, cl(country) fam(gauss) li(ident) nocons

estout M1d M2d M3d M4d M5d using TabA10.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace

estout M1e M2e M3e M4e M5e using TabA11.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace

estout M1f M2f M3f M4f M5f using TabA12.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace

estout M1g M2g M3g M4g M5g using TabA13.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A14

preserve
keep if id2==1
xtset country election

glm turnout_post pmp_period turnout_pre cons, cl(country) fam(binom) li(logit) nocons
eststo M6a: margins, dydx(pmp_period turnout_pre cons) post

glm turnout_post pmp_period l.pmp_period turnout_pre cons, cl(country) fam(binom) li(logit) nocons
eststo M6b: margins, dydx(pmp_period l.pmp_period turnout_pre cons) post

glm turnout_post pmp_period turnout_pre i.country, cl(country) fam(binom) li(logit)
eststo M6c: margins, dydx(pmp_period turnout_pre) post

glm turnout_post pmp_period l.pmp_period turnout_pre i.country, cl(country) fam(binom) li(logit)
eststo M6d: margins, dydx(pmp_period l.pmp_period turnout_pre) post

eststo M7a: glm turnout_diff pmp_period turnout_pre cons, cl(country) fam(gauss) li(ident) nocons

eststo M7b: glm turnout_diff pmp_period l.pmp_period turnout_pre cons, cl(country) fam(gauss) li(ident) nocons

eststo M7c: glm turnout_diff pmp_period turnout_pre i.country, cl(country) fam(gauss) li(ident)

eststo M7d: glm turnout_diff pmp_period l.pmp_period turnout_pre i.country, cl(country) fam(gauss) li(ident)

restore

estout M6a M6b M6c M6d M7a M7b M7c M7d using TabA14.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A16

preserve
keep if id2==1
xtset country election

glm pmp_period l.volatility l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M8a: margins, dydx(l.volatility l.pmp_period cons) post

glm pmp_period l2.volatility l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M8b: margins, dydx(l2.volatility l.pmp_period cons) post

glm pmp_period l.voteshare_new l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M8c: margins, dydx(l.voteshare_new l.pmp_period cons) post

glm pmp_period l2.voteshare_new l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M8d: margins, dydx(l2.voteshare_new l.pmp_period cons) post

restore

estout M8a M8b M8c M8d using TabA16.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A17 / Table A18

eststo M9: glm pmp_cabinet i.pm_fulltimepolit i.pm_partyhead i.pm_minister i.pm_parliament i.pm_oppleader i.pm_euinstitution i.pm_civilservant i.pm_communism_dissident i.pm_communism_government i.pm_communism_party i.pm_sex, cl(country) fam(binom) li(logit)

predict instrument if e(sample)
egen instrument_el = wtmean(instrument), by(country election) weight(cab_duration)

preserve
keep if id2==1
xtset country election

glm volatility instrument_el l.instrument_el l.volatility cons, cl(country) fam(binom) li(logit) nocons
eststo M1i: margins, dydx(instrument_el l.instrument_el l.volatility cons) post

glm voteshare_new instrument_el l.instrument_el l.voteshare_new cons, cl(country) fam(binom) li(logit) nocons
eststo M2i: margins, dydx(instrument_el l.instrument_el l.voteshare_new cons) post

restore

eststo M3i: glm voteshare_diff_pm instrument voteshare_t0_pm cons, cl(country) fam(gauss) li(ident) nocons

eststo M4i: glm voteshare_diff_opp instrument voteshare_t0_opp cons, cl(country) fam(gauss) li(ident) nocons

eststo M5i: glm voteshare_diff_coa instrument voteshare_t0_coa cons, cl(country) fam(gauss) li(ident) nocons

estout M9 using TabA17.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace

estout M1i M2i M3i M4i M5i using TabA18.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A20

preserve
keep if id2==1
xtset country election

eststo M11a: glm econ_performance_period pmp_period l.pmp_period l.econ_performance_period global_growth_period global_inflation_period global_unemployment_period cons, cl(country) fam(gauss) li(ident) nocons

eststo M11b: glm econ_performance_period l.pmp_period l.econ_performance_period global_growth_period global_inflation_period global_unemployment_period cons, cl(country) fam(gauss) li(ident) nocons

glm pmp_period econ_performance_period l.pmp_period cons, cl(country) fam(binom) li(logit) nocons
eststo M8e: margins, dydx(econ_performance_period l.pmp_period cons) post

glm volatility pmp_period l.pmp_period l.volatility econ_performance_period cons, cl(country) fam(binom) li(logit) nocons
eststo M1c: margins, dydx(pmp_period l.pmp_period l.volatility econ_performance_period cons) post

restore

estout M11a M11b M8e M1c using TabA20.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace


* Table A6

clear all
use repl_data

bysort country election cabinet: gen id1 = _n==1
bysort country election: gen id2 = _n==1
gen cons = 1

reg pmp ibn.cabinet, nocons r

preserve
drawnorm sim1-sim129, means(e(b)) cov(e(V)) n(1000) clear seed(1)
gen _mi_m = _n
reshape long sim, i(_mi_m) j(cabinet)
sort cabinet _mi_m
save sim.dta, replace
restore
// draw simulations on expert level

keep if id1==1
// set to cabinet level

mi set flong
mi set M = 1000
sort cabinet _mi_m
merge 1:1 cabinet _mi_m using sim.dta
drop _merge
// merge with simulations

egen sim_period = wtmean(sim), by(_mi_m country election) weight(cab_duration)
// generate election-level simulation

mi reg imp sim sim_period
// register "imputed" variables

mi xtset country cabinet_number

eststo M3b: mi est, post: glm voteshare_diff_pm sim voteshare_t0_pm cons, cl(country) fam(gauss) li(ident) nocons

eststo M4b: mi est, post: glm voteshare_diff_opp sim voteshare_t0_opp cons, cl(country) fam(gauss) li(ident) nocons

eststo M5b: mi est, post: glm voteshare_diff_coa sim voteshare_t0_coa cons, cl(country) fam(gauss) li(ident) nocons

keep if id2==1
mi xtset country election
// set to period level

mi est, post: glm volatility sim_period l.sim_period l.volatility cons, cl(country) fam(binom) li(logit) nocons
eststo M1b: mimrgns, dydx(sim_period l.sim_period l.volatility cons) post predict(default)

mi est, post: glm voteshare_new sim_period l.sim_period l.voteshare_new cons, cl(country) fam(binom) li(logit) nocons
eststo M2b: mimrgns, dydx(sim_period l.sim_period l.voteshare_new cons) post predict(default)

estout M1b M2b M3b M4b M5b using TabA6.doc, c(b(fmt(3) star) se(par fmt(3))) starl(+ 0.1 * 0.05 ** 0.01) s(N r2, fmt(0 3)) replace

